package com.fl.mybatisgenerator.thread;

public class TestYield {
    public static void main(String[] args) {
        myyield myyield = new myyield();
        new Thread(myyield,"线程1").start();
        new Thread(myyield,"线程2").start();
    }
}

class myyield implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"开始运行");
        Thread.yield();
        System.out.println(Thread.currentThread().getName()+"停止运行");
    }
}